package com.bbh.data.service.service.utils;

import com.bbh.common.exception.CustomerException;
import com.bbh.common.utils.web.spring.SpringUtils;
import org.apache.commons.lang3.ArrayUtils;

import java.util.Locale;

/**
 * Created by roman_000 on 2016/5/27.
 */
public class ErrorCodeUtils {

    public static CustomerException message(String code, Locale locale) {
        return new CustomerException(code,
                SpringUtils.getApplicationContext().getMessage(code, (Object[]) ArrayUtils.EMPTY_OBJECT_ARRAY, locale));
    }

    public static CustomerException message(String code, Object[] params, Locale locale) {
        return new CustomerException(code, SpringUtils.getApplicationContext().getMessage(code, params, locale));
    }
}
